﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="efetuarPagamentoAluno.aspx.cs"
    Inherits="sistemaAcademicoFinanceiroEscolas.efetuarPagamentoAluno" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="js/tabs-accordion.css" />
     <link rel="stylesheet" type="text/css" href="css/estilos.css" />
<link href="Site.css" rel="stylesheet" type="text/css" />

    <script src="js/jquery.tools.min.js"></script>

</head>

<script language="javascript">

    function finalizar() {
        alert('Registros salvos com sucesso.');
    }
    
</script>

<script language="javascript">
    //-----------------------------------------------------
    //Funcao: MascaraMoeda
    //Sinopse: Mascara de preenchimento de moeda
    //Parametro:
    //   objTextBox : Objeto (TextBox)
    //   SeparadorMilesimo : Caracter separador de milésimos
    //   SeparadorDecimal : Caracter separador de decimais
    //   e : Evento
    //Retorno: Booleano
    //-----------------------------------------------------
    function valoresNumericos(objTextBox, SeparadorMilesimo, SeparadorDecimal, e) {
        var sep = 0;
        var key = '';
        var i = j = 0;
        var len = len2 = 0;
        var strCheck = '0123456789';
        var aux = aux2 = '';
        var whichCode = (window.Event) ? e.which : e.keyCode;
        if (whichCode == 13) return true;
        key = String.fromCharCode(whichCode); // Valor para o código da Chave
        if (strCheck.indexOf(key) == -1) return false; // Chave inválida
        len = objTextBox.value.length;
        for (i = 0; i < len; i++)
            if ((objTextBox.value.charAt(i) != '0') && (objTextBox.value.charAt(i) != SeparadorDecimal)) break;
        aux = '';
        for (; i < len; i++)
            if (strCheck.indexOf(objTextBox.value.charAt(i)) != -1) aux += objTextBox.value.charAt(i);
        aux += key;
        len = aux.length;
        if (len == 0) objTextBox.value = '';
        if (len == 1) objTextBox.value = '0' + SeparadorDecimal + '0' + aux;
        if (len == 2) objTextBox.value = '0' + SeparadorDecimal + aux;
        if (len > 2) {
            aux2 = '';
            for (j = 0, i = len - 3; i >= 0; i--) {
                if (j == 3) {
                    aux2 += SeparadorMilesimo;
                    j = 0;
                }
                aux2 += aux.charAt(i);
                j++;
            }
            objTextBox.value = '';
            len2 = aux2.length;
            for (i = len2 - 1; i >= 0; i--)
                objTextBox.value += aux2.charAt(i);
            objTextBox.value += SeparadorDecimal + aux.substr(len - 2, len);
        }
        return false;
        var charCode = (evt.which) ? evt.which : event.keyCode
        if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;
        return true;
    }

    function numero(e) {
        var charCode = (e.which) ? e.which : event.keyCode
        if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;
        return true;
    }

    function finalizar(texto) {
        alert(texto);
    }

    function formatar(src, mask) {

        var i = src.value.length;
        var saida = mask.substring(0, 1);
        var texto = mask.substring(i);

        if (texto.substring(0, 1) != saida) {
            src.value += texto.substring(0, 1);
        }

    }
                
</script>

<body>
    <form id="form1" runat="server">
    <h2 class="titulo">
        Definir pagamento do aluno</h2>
    <div>
        <table width="500px">
            <tr align="center" valign="middle">
                <td class="textoNegro">
                    Aluno:
                </td>
                <td>
                    <asp:DropDownList ID="lstAluno" runat="server">
                    </asp:DropDownList>
                </td>
                <td>
                    <asp:Button ID="btnListar" runat="server" Text="Listar" OnClick="btnListar_Click" />
                </td>
            </tr>
        </table>
        <br />
        <hr />
        <table width="100%">
            <tr>
                <td width="510px" align="center">
                    <asp:Label ID="lblAluno" runat="server" Font-Bold="True" Font-Size="XX-Large" ForeColor="Blue"></asp:Label>
                    <br />
                    <br />
                    <asp:Panel ID="Panel1" runat="server" Width="510px">
                    </asp:Panel>
                </td>
                <td align="left" valign="top">
                    <asp:Panel ID="Panel3" runat="server" Visible="false">
                        <table width="100%" border="1" cellpadding="5" cellspacing="0" bordercolor="#99CCFF"
                            style="background-color: #f6f9fc">
                            <tr>
                                <th colspan="3">
                                    Informações do aluno
                                </th>
                            </tr>
                            <tr>
                                <th>
                                    Valor total
                                </th>
                                <th>
                                    Valor pago
                                </th>
                                <th>
                                    Débito / Crédito
                                </th>
                            </tr>
                            <tr align="left" valign="middle">
                                <td>
                                    <asp:Label ID="ldlValor" runat="server" Text=""></asp:Label>&nbsp;&nbsp;<img src="images/info.png"
                                        width="15px" height="15px" title="Valor referente apenas das aulas efetivas." />
                                </td>
                                <td>
                                    <asp:Label ID="lblValorPago" runat="server" Text=""></asp:Label>
                                </td>
                                <td align="right">
                                    <asp:Label ID="lblDividaCredito" runat="server" Text="" Font-Size="X-Large"></asp:Label>
                                </td>
                            </tr>
                        </table>
                        <br />
                        <table width="100%" border="1" cellpadding="5" cellspacing="0" bordercolor="#99CCFF" style="background-color: #f6f9fc">
                            <tr>
                                <th colspan="4">
                                    Efetuar pagamento
                                </th>
                            </tr>
                            <tr align="center" valign="middle">
                                <th>
                                    Valor pago:
                                </th>
                                <th>
                                    Forma de pagamento:
                                </th>
                                <th>
                                    Data:
                                </th>
                                <th>
                                    Observação:
                                </th>
                            </tr>
                            <tr align="center" valign="middle">
                                <td>
                                    <asp:TextBox ID="txtValorPago" runat="server" onkeypress="return(valoresNumericos(this,'.',',',event));"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:DropDownList ID="lstFormaPagamento" runat="server"></asp:DropDownList>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtData" runat="server" MaxLength="10" OnKeyPress="formatar(this, '##/##/####')"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtObservacao" runat="server" TextMode="MultiLine" Rows="3"></asp:TextBox>
                                </td>
                            </tr>
                            <tr align="right" valign="middle">
                                <td colspan="4">
                                    <asp:Button ID="btnSalvar" runat="server" Text="Salvar" OnClick="btnSalvar_Click" />
                                </td>
                            </tr>
                        </table>
                        <br />
                        <asp:Panel ID="Panel2" runat="server">
                        </asp:Panel>
                    </asp:Panel>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
